home *** CD-ROM | disk | FTP | other *** search
/ World of Education / World of Education.iso / world_x / xcoral16.zip / TEXT.H < prev    next >
C/C++ Source or Header  |  1993-01-15  |  7KB  |  213 lines

  1. /*
  2. ** Copyright 1989, 1992 by Lionel Fournigault
  3. **
  4. ** Permission to use, copy, and distribute for non-commercial purposes,
  5. ** is hereby granted without fee, providing that the above copyright
  6. ** notice appear in all copies and that both the copyright notice and this
  7. ** permission notice appear in supporting documentation.
  8. ** The software may be modified for your own purposes, but modified versions
  9. ** may not be distributed.
  10. ** This software is provided "as is" without any expressed or implied warranty.
  11. **
  12. **
  13. */
  14.  
  15. #ifndef  _TEXT_H_
  16. #define  _TEXT_H_
  17.  
  18. #include "buffer.h"
  19. #include "scroll.h"
  20. #include "buttons.h"
  21.  
  22. /*
  23.  *    Le ressources pour les fenetres Texte.
  24.  */
  25. typedef struct {
  26.     GC    cgc;    /* Contexte graphique standard */
  27.     GC    igc;    /* Contexte graphique inverse */
  28.     unsigned long fg, bg, top_sh, bot_sh; /* Les couleurs */
  29.     XFontStruct *font;    /* La fonte */
  30. } TextResources;
  31.  
  32. /*
  33.  *    Toutes les infos sur le texte.
  34.  */
  35. typedef struct {
  36.     Window window;        /* La fenetre de texte */
  37.     Window w_parent;    /* La fenetre parent */
  38.     int width, height;    /* Les dimensions */
  39.     int lines_in_buf;    /* Nombre de lignes dans le buffer */
  40.     int no_current_line;    /* Numero de la ligne courante */
  41.     int lines_in_page;    /* Nombre de ligne dans la page */
  42.     int n1, n2;        /* Nb de ligne avant/apres le curseur */
  43.     XFontStruct *font;    /* La fonte utilisee */
  44.     int char_width_ave;    /* Largeur moyenne d'un caractere */
  45.     int font_height;    /* Hauteur de la fonte en pixels */
  46.     GC Cgc;            /* Le context graphique courant */
  47.     GC Igc;            /* Le context graphique pour l'inverse */
  48.     unsigned long fg, bg;    /* Le devant et le fond */
  49.     unsigned long   top_sh, bot_sh; /* Shadow */
  50.     int x_or, y_or;    /* Origine     */
  51.     int x_pos, y_pos;    /* Position courante dans la fenetre */
  52.     int cursor_height;    /* Hauteur du curseur */
  53.     int cursor_width;    /* Largeur moyenne du curseur */
  54.     int cursor_stat;    /* Etat du curseur */
  55.     int mouse_in;        /* Mouse in the window */
  56.     int sl;            /* Horizontal Scroll */
  57.  
  58.     char filename [256];
  59.     char current_dir [256];
  60.     int modif;
  61.     int stat;
  62.     int visible;
  63.     
  64.     Buf *buf;    /* Le Buffer */
  65.     SWin *swin;    /* Le scroll */
  66.     MWin *mwin;     /* La fenetre des messages et bouttons */
  67.     int width_relief;
  68.  
  69.     struct {
  70.            int      wline [256];    /* La largeur des lignes */
  71.            char     *sline [256];    /* La table des lignes */
  72.     } page;
  73.  
  74.     int markline;    /* Le numero de la ligne */
  75.     int markpos;    /* La position dans la ligne */
  76.     
  77.     int mode;
  78.     char indent[8];
  79.     int tab_width;
  80. } Text;
  81.  
  82. #define GetTextWindow(text)     ( text -> window )
  83. #define GetModif(text)        ( text -> modif )
  84. #define GetFileName(text)    ( text -> filename )
  85. #define SetLineInPage(text,n)     ( text -> lines_in_page = n )
  86. #define GetMode(text)        ( text -> mode )
  87. #define GetCursorStat(text)    ( text -> cursor_stat )
  88. #define GetScrollStat(text)    ( text -> sl )
  89. #define GetNbLinesInBuf(text)    ( text -> lines_in_buf )
  90.  
  91. /*
  92.  *    Public
  93.  */
  94. extern void     InitTextRes ( /* display, font, fg, bg, ts, bs */ );
  95. extern Text    *MakeTextWindow ( /* display, parent, x, y */ );
  96. extern void    DeleteText ( /* display, text */ );
  97. extern int    GetVisibility ( /* display, text */ );
  98. extern void    KillText ( /* display, text */ );
  99. extern void     SetFontText ( /*display, text, font */ );
  100. extern void     ChangeTextFont ( /* display, text, f */ );
  101. extern void     ShowWindowText ( /* display, text,width, height */ );
  102. extern void    ExposeTextWindow ( /* display,text */ );
  103.  
  104. extern void    TextCursorOn ( /* text */ );
  105. extern void    TextCursorOff ( /* text */ );
  106. extern void    FreeseTextCursor ( /* text */ );
  107. extern void    UnFreeseTextCursor ( /* text */ );
  108.  
  109. extern int    MoveToXYinTextWindow ( /* text, x, y */ );
  110. extern int     SetTextVisibility ( /* text, state */ );
  111. extern int     GetLineInPage ( /* text, font */ );
  112. extern int     TextInBuf ( /* text */ );
  113. extern void    MouseIn ( /* text */ );
  114. extern void    MouseOut ( /* text */ );
  115. extern void    FirstPage ( /* text */ );
  116. extern void    ClearPage ( /* text */ );
  117. extern void    ClipOn ( /* text, line */ );
  118. extern void    ClipOff ( /* text */ );
  119. extern void    ExposePage ( /* r, text */ );
  120. extern void    SetLinesTable ( /* text */ );
  121. extern void    SetCurrentLine ( /* text */ );
  122. extern void    RefreshPage ( /* text */ );
  123. extern void    ClearLine ( /* text, i */ );
  124. extern void    LastPage ( /* text */ );
  125. extern void    PreviousPage ( /* text */ );
  126. extern void     NextPage ( /* text */ );
  127. extern void    GotoEnd ( /* text */ );
  128. extern void    CurrentLineToTop ( /* text */ );
  129. extern void    GotoLineNumber ( /* text, n */ );
  130. extern void    ScrollNLine ( /* n, text */ );
  131. extern void    CurrentLineToMiddle ( /* text */ );
  132. extern void    SetAndDisplayPage ( /* text */ );
  133. extern void    ScrollDownCont ( /* text */ );
  134. extern void    ScrollUpCont ( /* text */ );
  135. extern void    SetMark ( /* text */ );
  136. extern void    ExchangePointMark ( /* text */ );
  137. extern void    KillRegion ( /* text */ );
  138. extern void    CopyRegion ( /* text */ );
  139. extern void    PasteRegion ( /* text */ );
  140. extern void    ForwardSearch ( /* text */ );
  141. extern void    BackwardSearch ( /* text */ );
  142. extern void    QueryReplace ( /* text */ );
  143. extern void    GlobalReplace ( /* text */ );
  144. extern void    GotoPos ( /* text, start, newpos, dir */ );
  145. extern void    ResetSearchString ();
  146.  
  147. extern void    MoveToBline ( /* text */ );
  148. extern void    MoveToEline ( /* text */ );
  149. extern void    DownCursor ( /* text */ );
  150. extern void    UpCursor ( /* text */ );
  151. extern int    ForwardChar ( /* text */ );
  152. extern void    BackwardChar ( /* text */ );
  153. extern char    *HscrollString ( /* s, n, tabwidth */ );
  154. extern void    GotoLeft ( /* text */ );
  155.  
  156. extern void    KillCurrentBuffer ( /* text */ );
  157. extern int    LoadFile ( /* text, s, type */ );
  158. extern int    SaveCurrentBuffer ( /* text, from */ );
  159. extern void    SetDirAndFilename ( /* text, name */ );
  160. extern void    ChangeDir ( /* text */ );
  161.  
  162. extern void    f_impc ( /* text, c */ );
  163. extern void    f_return ( /* text */ );
  164. extern void    f_tab ( /* text */ );
  165. extern void    f_delete ( /* text */ );
  166. extern void    Control_D ( /* text */ );
  167. extern void    Control_K ( /* text, n */ );
  168. extern void    Control_Y ( /* text, i */ );
  169. extern void    GetBytesFromCutBuffer ( /* text */ );
  170. extern void    StoreBytesInCutBuffer ( /* text, x, y */ );
  171. extern void    DeleteBytesFromCutBuffer ( /* text */ );
  172. extern void    SetDefaultMode ( /* text */ );
  173. extern void    SetCMode ( /* text */ );
  174. extern void    SetCCMode ( /* text */ );
  175.  
  176. #define TAB_WIDTH    8
  177. #define INDENT_WIDTH    3
  178. #define    OFF        0
  179. #define ON              1
  180.  
  181. #define    MARGE    10
  182. #define W_SPACE 5
  183.  
  184. #define W_RELIEF    2
  185. #define FREESE        2
  186. #define UNFREESE    3
  187. #define MSET(x,y)    ( x |= y )
  188. #define MCLEAR(x,y)    ( x &= (~y) )
  189. #define MESSAGE        ( 1 << 0 )
  190. #define FIRSTPAGE    ( 1 << 1 )
  191. #define LASTPAGE    ( 1 << 2 )
  192.  
  193. #define END_MESS "This is the end... my friend the end"
  194.  
  195. #define STD_C    1
  196. #define CPLUS    2
  197. #define TEXT    3    /* default */
  198. #define LATEX    4
  199.  
  200. #define F_KEY    0
  201. #define F_MENU    1
  202.  
  203. #define FILESELECT    0    
  204. #define KILLBUF        1
  205. #define OPENFILES    2
  206.  
  207. #endif /* _TEXT_H_ */
  208.  
  209.  
  210.  
  211.  
  212.  
  213.